class Solution(object):
    def checkMove(self, board, rMove, cMove, color):
        m = len(board)
        n = len(board[0])
        for ux, uy in [(-1, 0),(1, 0),(0, -1),(0, 1),(1,1),(1,-1),(-1,1),(-1,-1)]:
            if 0 <= rMove + ux < m and 0 <= cMove + uy < n:
                if board[rMove + ux][cMove + uy] != '.' and board[rMove + ux][cMove + uy] != color:
                    index = 2
                    while 0 <= rMove + index * ux < m and 0 <= cMove + index * uy < n:
                        if board[rMove + index * ux][cMove + index * uy] == color:
                            return True
                        else:
                            if board[rMove + index * ux][cMove + index * uy] == '.':
                                break
                            else:
                                index += 1
        return False